package com.lx.pc.restful.quotationanalysis;

import java.io.IOException;
import java.math.BigInteger;
import java.util.HashMap;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import com.alibaba.fastjson.JSON;
import com.lx.pc.domain.vo.quotationanalysis.QuotationanalysisVo;
import com.lx.pc.restful.BaseController;
import com.lx.pc.service.quotationanalysis.IQuotationanalysisService;
import com.lx.pc.utils.OmsPage;

/**
 * 行情评析
 * @author houzhong
 *
 */
@Controller
@RequestMapping(name = "quotationanalysis")
public class QuotationanalysisController extends BaseController{

	@Resource(name = "quotationanalysisService")
	private IQuotationanalysisService quotationanalysisService;
	
	/**
	 * 行情评析列表
	 * @return
	 */
	@RequestMapping(value = "/toQuotationanalysitList.do")
	public ModelAndView toQuotationanalysitList() {
		ModelAndView mv = new ModelAndView("/information/analysis_list");
		return mv;
	}
	
	/**
	 * 行情评析
	 * @param v
	 * @param page
	 * @param size
	 * @return
	 * @throws IOException
	 */
	@RequestMapping("/quotationanalysisList.do")
	@ResponseBody
    public  String quotationanalysisList(QuotationanalysisVo v,Integer page,Integer size) throws IOException {
        Map<String,Object> result = new HashMap<String, Object>();
        OmsPage<QuotationanalysisVo> pages = quotationanalysisService.findByQuotationanalysis(v, page, size);
        result.put("quotationqnalysis", pages);
        return JSON.toJSONString(result);
    }
	
	/**
	 * 详情页
	 * @return
	 */
	@RequestMapping(value = "/toQuotationanalysisDetails.do")
	public ModelAndView toQuotationanalysisDetails(String id) {
		ModelAndView mv = new ModelAndView("/information/analysis_details");
		BigInteger bId = new BigInteger(id); 
		QuotationanalysisVo quotationanalysis = quotationanalysisService.findByQuotationanalysisId(bId);
		
		mv.addObject("quotationanalysis",quotationanalysis);
		return mv;
	}
}
